// 来自榜单ZnPdCo
#include <bits/stdc++.h>
using namespace std;
char op[9];
int q, n;
char a[200010];
struct node {
    vector<bool> sta;
    int x, y;
} l[1 << 10];
int len = 0;
struct DFA {
    bool ac[16][1 << 15], acc[60];
    pair<int, int> pm[60];
    int mp[10][1 << 9];
    int cnt = 0;
    inline void build() {
        ac[1][1] = 1;
        for (int i = 2; i <= 15; i++) {
            for (int s = 0; s < (1 << i); s++) {
                int s1 = 0, s2 = s;
                for (int j = 0; j <= i - 2; j++) {
                    int t = ((((s2 >> 2) << 1) | op[s2 & 3]) << j) | s1;
                    ac[i][s] |= ac[i - 1][t];
                    s1 |= (s2 & 1) << j;
                    s2 >>= 1;
                }
            }
        }
        len = 0;
        for (int i = 1; i <= 9; i++) {
            for (int s = 0; s < (1 << i); s++) {
                l[++len].sta.clear();
                l[len].x = i, l[len].y = s, l[len].sta.push_back(ac[i][s]);
                for (int j = 1; j <= 6; j++) {
                    for (int t = 0; t < (1 << j); t++) {
                        l[len].sta.push_back(ac[i + j][(s << j) | t]);
                    }
                }
            }
        }
        sort(l + 1, l + len + 1, [](node a, node b) {
            if (a.sta != b.sta) return a.sta < b.sta;
            return a.x < b.x;
        });
        for (int i = 1; i <= len; i++) {
            if (i == 1 || l[i].sta != l[i - 1].sta) {
                mp[l[i].x][l[i].y] = ++cnt;
                pm[cnt] = make_pair(l[i].x, l[i].y);
                acc[cnt] = ac[l[i].x][l[i].y];
            } else {
                mp[l[i].x][l[i].y] = cnt;
            }
        }
    }
} d[17];
long long f[200010][60], g[200010][60], ans1, ans2;
void solve(int idx) {
    ans1 = ans2 = 0;
    ans2 = -1;
    for (int i = 0; i <= n; i++) for (int j = 0; j <= d[idx].cnt; j++) f[i][j] = 0, g[i][j] = -1e9;
    for (int i = 1; i <= n; i++) {
        f[i][d[idx].mp[1][a[i]]] = g[i][d[idx].mp[1][a[i]]] = 1;
        if (i > 1) for (int j = 1; j <= d[idx].cnt; j++) {
            auto [l, s] = d[idx].pm[j];
            int x = d[idx].mp[l + 1][(s << 1) | a[i]];
            f[i][x] += f[i - 1][j];
            g[i][x] = max(g[i][x], g[i - 1][j] + 1);
        }
        for (int j = 1; j <= d[idx].cnt; j++) if (d[idx].acc[j]) {
            ans1 += f[i][j];
            ans2 = max(ans2, g[i][j]);
        }
    }
    printf("%lld %lld\n", ans2, ans1);
}
int main() {
    // freopen("operation104.in", "r", stdin);
    // freopen("operation104.out", "w", stdout);
    scanf("%*d%s", a + 1);
    n = strlen(a + 1);
    for (int i = 1; i <= n; i++) a[i] -= '0';
    int cnt = 0;
    for (int op0 = 0; op0 <= 1; op0++) {
        for (int op1 = 0; op1 <= 1; op1++) {
            for (int op2 = 0; op2 <= 1; op2++) {
                for (int op3 = 0; op3 <= 1; op3++) {
                    op[0] = op0, op[1] = op1, op[2] = op2, op[3] = op3;
                    d[++cnt].build();
                    solve(cnt);
                }
            }
        }
    }
}